/**
 * 动画函数
 * @param {Object} obj
 * @param {Object} attr
 * @param {Object} endTarget
 */
var speed = 0;
function startAnimation(obj, attr, endTarget,fn) {
				// 针对于多物体运动,定时器的返回值要绑定当前的对象中.
				clearInterval(obj.timer);
				let cur = 0;
				obj.timer = setInterval(function(){
					if(attr === 'opacity') {
						cur = Math.round(parseFloat(getStyle(obj,attr)) * 100);
					}else{
						cur = parseInt(getStyle(obj,attr));
					}
					speed = (endTarget - cur) / 20;
					speed = endTarget > cur ? Math.ceil(speed) : Math.floor(speed);
					if(endTarget === cur) {
						clearInterval(obj.timer);
						if(fn) {
							fn();
						}
						return;
					}
					if(attr === 'opacity') {
						obj.style[attr] = `alpha:(opacity: ${cur + speed})`;
						obj.style[attr] = (cur + speed) / 100;
					}else{
						obj.style[attr] = cur + speed + 'px';
					}
				},30);
			}
/**
	* 获取元素属性的函数
	* @param {Object} obj 当前元素对象
	* @param {Object} attr 当前元素对象的属性
	*/
			function getStyle(obj, attr) {
				if (obj.currentStyle) {
					// 兼容ie
					return obj.currentStyle[attr];
				} else {
					// 兼容主流浏览器
					return getComputedStyle(obj, null)[attr];
				}
			}